//document.domain = 'arte.tv';
var Tv_Arte_Render;
(function()
{

    Tv_Arte_Render =
	{
	    _createPlaceholder:function($element)
	    {
	        if ($element.length == 0) return;
			$element
				.data('_placeholder', $element.val())
				.blur(function(event)
				{
                    if ($element.val().length == 0) $element.val($element.data('_placeholder'));
				})
				.focus(function(event)
				{
					if ($element.val() == $element.data('_placeholder')) $element.val('');
				});
	    },
	    _handleLinks:function()
	    {
	        /*$('#lang a').click(function(event)
	        {
	            event.preventDefault();
	            if (parent.document) {
	                parent.location.href = $(this).attr('href');
	            } else {
	                if (console && console.log)
	                	console.log('ERREUR CROSSDOMAIN');
	            }
	        }); */

	        //#lang => pas de popup
	        // #container a:first
	    },
	    initialize:function()
	    {
	        $(document).ready(function(event)
	        {
		        SELF._createPlaceholder($('#login'));
		        SELF._createPlaceholder($('#password'));
		        SELF._handleLinks();
	        });
	    }
	}
	
	var SELF = Tv_Arte_Render;
	
})();
  /*
//document.domain = 'arte.tv'
	
jQuery(function() {
	//manage events in form
	var oldValue;
	jQuery("#login,#password").bind("focusin", function(event)
    {
		oldValue = jQuery(this).attr("value");
		jQuery(this).attr("value","");
    });
	jQuery("#login,#password").bind("focusout", function(event)
    {
		jQuery(this).attr("value",oldValue);
    });
	
	//manage click on anv links
	jQuery("a").bind("click", function(event)
    {
		try
		{
			if(typeof(parent.document)=="undefined")
			{
				console.log("policy not ok");
				window.open(jQuery(this).attr('href'));
				return false;
			}
		}
		catch (e) //case crossdomain policies
		{
			console.log("policy not ok")
			window.open(jQuery(this).attr('href'));
			return false;
		}
		console.log("policy ok")
		parent.location.href = jQuery(this).attr('href');
		return false;
    });
    

    
});*/